<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>05作用域插槽</title>
  </head>
  <body>
    <div id="app">
      <h1>vue的例子</h1>
      <p>{{msg}}</p>
      <Demo>
        <template v-slot="info">
          <p>默认插槽</p>
          <h4>{{info.xx}}</h4>
          <h4>{{info.age}}</h4>
          <h4>{{info.skill}}</h4>
        </template>
      </Demo>
    </div>
    <script src="./js/vue.js"></script>
    <script>

      Vue.config.productionTip = false // 关闭生产提示
      Vue.component('Demo', {
        template: `
            <div>
                <p>这是子组件Demo</p>
                <slot :xx="name" :age="age" :skill="skill"></slot>
                <slot :xx="name" :age="age" :skill="skill"></slot>
            </div>
        `,
        data() {
          return {
            name: '轩轩',
            age: 11,
            skill: {
              eat: '吃饭',
              sleep: '睡觉',
            },
          }
        },
      })
      const vm = new Vue({
        el: '#app',
        data: {
          msg: 'hello',
        },
      })
    </script>
  </body>
</html>
